package com.codeduck.injection.config;

import com.codeduck.injection.entity.Mobile;
import com.codeduck.injection.entity.SuperMobile;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * @author: <a href="mailto:codeduck@163.com">Codeduck</a>
 * @createDate: 2021-12-24
 */
@Configuration
public class ProfileBeanConfig {

    /**
     * 测试方法 {@link com.codeduck.injection.ProfileBeanConfigTest}
     *
     * 不同环境下注入不同的Bean
     */

    @Bean
    @Profile("test")
    public Mobile mobile() {
        return new Mobile();
    }

    @Bean
    @Profile("dev")
    public SuperMobile superMobile() {
        return new SuperMobile();
    }
}
